//
//  CCBaseModel.m
//  HimalayaMountain
//
//  Created by dllo on 16/7/13.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "CCBaseModel.h"

@implementation CCBaseModel

// 容错方法

-(void)setValue:(id)value forUndefinedKey:(NSString *)key{
    
}

-(void)setNilValueForKey:(NSString *)key{
    
}


-(instancetype)initWithDic:(NSDictionary *)dic{
    
    if (self = [super init]) {
        
        [self setValuesForKeysWithDictionary:dic];
        
    }
    return self;
}

+(instancetype)baseModelWithDic:(NSDictionary *)dic{
    id model = [[[self class] alloc]initWithDic:dic];
    return [model autorelease];
}




+(NSArray *)arrayFromArray:(NSArray *)array{
    
    NSMutableArray *mulArray = [NSMutableArray array];
    
    
    for (NSDictionary *dic in array) {
    
        @autoreleasepool {
            id model = [[self class] baseModelWithDic:dic];
            [mulArray addObject:model];
        }

    }

    return [NSArray arrayWithArray:mulArray];
    
    
}



@end
